local skel = fk.CreateSkill {
  name = "#Freeze_skill"
}

---@class Utility_LB_Kill
local LB_U = require "packages.lb_kill_utility._base"

Fk:loadTranslationTable {
  ["#Freeze_skill"] = "冻结",
  ["@@FreezeHp"] = "冻结",
  ["@@FreezeHp-round"] = "冻结",
  ["@@FreezeHp-turn"] = "冻结",
  ["@@FreezeHp-phase"] = "冻结",
}

skel:addEffect(fk.BeforeHpChanged, {
  priority = 0.001,
  can_trigger = function(self, event, target, player, data)
    return target == player and not player.dead and LB_U.isfreezeHp(player) and data.num ~= 0
  end,
  on_trigger = function(self, event, target, player, data)
    LB_U.unfreezeHp(player)
    if data.shield_lost == 0 then -- 不管护甲
      data.prevented = true
    else
      data.num = 0
    end
  end,
})

skel:addEffect(fk.BeforeMaxHpChanged, {
  priority = 0.001,
  can_trigger = function(self, event, target, player, data)
    return target == player and not player.dead and LB_U.isfreezeHp(player) and data.num ~= 0
  end,
  on_trigger = function(self, event, target, player, data)
    data:preventMaxHpChange()
    LB_U.unfreezeHp(player)
  end,
})

skel:addEffect(fk.DetermineDamageInflicted, {
  priority = 0.001,
  can_trigger = function(self, event, target, player, data)
    return target == player and not player.dead and LB_U.isfreezeHp(player) 
    and data.damage > 0 and not data.prevented and data.damageType == fk.FireDamage
  end,
  on_trigger = function(self, event, target, player, data)
    data.damage = data.damage + 1
    LB_U.unfreezeHp(player)
  end,
})

return skel
